package com.learn.hibernatevalidator.chapter09.clockprovider;

import jakarta.validation.ClockProvider;

import java.time.Clock;
import java.time.ZonedDateTime;

/**
 * @author: liyf
 * @create: 2025-01-20 22:21
 **/
public class FixedClockProvider implements ClockProvider {

    private Clock clock;

    public FixedClockProvider(ZonedDateTime zonedDateTime) {
        clock = Clock.fixed(zonedDateTime.toInstant(), zonedDateTime.getZone());
    }

    @Override
    public Clock getClock() {
        return clock;
    }
}
